{% extends "tj3/tj3.html" %}


{% block content  %} 

<h2>{{resource.first_name|capfirst }} {{resource.last_name|capfirst }} [{{resource.work_limit.id}}]</h2>
Worked for <a href={% url task_detail task.id %}>{{task.name}}</a> on {{now}}</h5>

<form action="." method="post" enctype="multipart/form-data">

<h2>Booking</h2>
<!--- iterate exist bookings --->
<table>
{{ booking_formset.management_form }}
<thead>
<th>WHEN<th>PART OF DAY<th>LENGTH<th>OVERTIME<th>TASK<th>RESOURCE
</thead>
<tbody>
<!--- old bookings --->
{% for b in bookings %}
<tr>

	<td><a href={% url booking_edit b.id %}>{{b.when}}</a>
	<td>{{b.part_of_day}}
	<td>{{b.length}}
	<td>{{b.overtime}}
	<td>{{b.task}}
	<td>{{b.resource}}

</tr>
{% endfor %}

{% for b in booking_formset.forms %}
<tr>
	<td>{{b.when}}
	<td>{{b.part_of_day}}
	<td>{{b.length}}
	<td>{{b.overtime}}
	<td>{{b.task}}
	<td>{{b.resource}}
</tr>	
{% endfor %}
</tbody>
</table>

<h2>Journal</h2>
<!--- iterate existing journals --->
<table>
{{ journal_formset.management_form }}
{{ journal_formset }}
</table>

<input type="submit" value="Add new booking journal" class="button" />
</form>   

<table>
<thead>
<th>CREATED<th>BOOKING<th>SUMMARY<th>DESCRIPTION<th>MEMO
</thead>
<tbody>
{% for j in journals %}
<tr>
	<td>{{j.created}}
	<td>{{j.booking}}
	<td><a href={% url journal_edit j.id %}>{{j.summary}}</a>
	<td>{{j.description}}
	<td>{{j.memo}}
</tr>
{% endfor %}
</tbody>
</table>
 {% endblock content %}
